#ifndef __SD_TABLE_H__
#define __SD_TABLE_H__

#include "coordinate_2d.h"

namespace SeaDrip
{
    template<typename T>
    class Table
    {
    public:
        Table(const unsigned int _width, const unsigned int _height, const T* data)
            : width(_width), height(_height), m_p_data(data) {}

        const T* operator[] (const unsigned int line) const noexcept
        {
            return m_p_data + line * width;
        }

        const T operator[] (const Coordinate2D& coor) const noexcept
        {
            return *(m_p_data + coor.y * width + coor.x);
        }

        const unsigned int width;
        const unsigned int height;

    private:
        const T* m_p_data;
    };
}

#endif